//
//  UIView+JMIPLayout.m
//  ImagePicker
//
//  Created by Jamin on 2018/10/16.
//  Copyright © 2018 jamin. All rights reserved.
//

#import "UIView+JMIP.h"

@implementation UIView (JMIPLayout)

- (void)setJm_originX:(CGFloat)jm_originX {
    CGRect frame = self.frame;
    frame.origin.x = jm_originX;
    self.frame = frame;
}

- (CGFloat)jm_originX {
    return self.frame.origin.x;
}

- (void)setJm_originY:(CGFloat)jm_originY {
    CGRect frame = self.frame;
    frame.origin.y = jm_originY;
    self.frame = frame;
}

- (CGFloat)jm_originY {
    return self.frame.origin.y;
}

- (void)setJm_width:(CGFloat)jm_width {
    CGRect frame = self.frame;
    frame.size.width = jm_width;
    self.frame = frame;
}

- (CGFloat)jm_width {
    return self.frame.size.width;
}

- (void)setJm_height:(CGFloat)jm_height {
    CGRect frame = self.frame;
    frame.size.height = jm_height;
    self.frame = frame;
}

- (CGFloat)jm_height {
    return self.frame.size.height;
}

- (void)setJm_size:(CGSize)jm_size {
    CGRect frame = self.frame;
    frame.size = jm_size;
    self.frame = frame;
}

- (CGSize)jm_size {
    return self.frame.size;
}

- (void)setJm_origin:(CGPoint)jm_origin {
    CGRect frame = self.frame;
    frame.origin = jm_origin;
    self.frame = frame;
}

- (CGPoint)jm_origin {
    return self.frame.origin;
}

- (void)setJm_centerX:(CGFloat)jm_centerX {
    CGPoint center = self.center;
    center.x = jm_centerX;
    self.center = center;
}

- (CGFloat)jm_centerX {
    return self.center.x;
}

- (void)setJm_centerY:(CGFloat)jm_centerY {
    CGPoint center = self.center;
    center.y = jm_centerY;
    self.center = center;
}

- (CGFloat)jm_centerY {
    return self.center.y;
}

- (void)setJm_right:(CGFloat)jm_right {
    self.jm_originX = jm_right - self.jm_width;
}

- (CGFloat)jm_right {
    return  self.jm_originX + self.jm_width;
}

- (void)setJm_bottom:(CGFloat)jm_bottom {
    self.jm_originY = jm_bottom - self.jm_height;
}

- (CGFloat)jm_bottom {
    return self.jm_originY + self.jm_height;
}

@end
